package com.example.dicomviewer;

import androidx.annotation.NonNull;

import org.dcm4che3.data.Attributes;
import org.dcm4che3.data.Tag;
import org.dcm4che3.data.VR;

/*
 * 工具类
 * 用来存储Dicom信息的类
 * */
public class DicomInfo {
    String picture;
    String patientName;
    String patientBirthDate;
    String institution;
    String station;
    String studyDescription;
    String seriesDescription;
    String manufacturerModelName;
    String manufacturer;
    String studyDate;

    public DicomInfo() {
    }

    @NonNull
    @Override
    public String toString() {
        return "姓名: " + getPatientName() + "\n" +
                "生日: " + getPatientBirthDate() + "\n" +
                "机构:" + getInstitution() + "\n" +
                "站点: " + getStation() + "\n" +
                "制造商: " + getManufacturer() + "\n" +
                "制造商模型: " + getManufacturerModelName() + "\n" +
                "描述: " + getStudyDescription() + "\n" +
                "具体描述: " + getSeriesDescription() + "\n" +
                "描述时间: " + getStudyDate() + "\n";
    }

    public DicomInfo(Attributes attributes) {
        //修改默认字符集为GB18030
        attributes.setString(Tag.SpecificCharacterSet, VR.CS, "GB18030");//解决中文乱码问题

        //患者姓名
        patientName = attributes.getString(Tag.PatientName, "");

        //生日
        patientBirthDate = attributes.getString(Tag.PatientBirthDate, "");

        //机构
        institution = attributes.getString(Tag.InstitutionName, "");

        //站点
        station = attributes.getString(Tag.StationName, "");

        //制造商
        manufacturer = attributes.getString(Tag.Manufacturer, "");

        //制造商模型
        manufacturerModelName = attributes.getString(Tag.ManufacturerModelName, "");

        //描述
        studyDescription = attributes.getString(Tag.StudyDescription, "");

        //描述--具体
        seriesDescription = attributes.getString(Tag.SeriesDescription, "");

        //描述时间
        studyDate = attributes.getString(Tag.StudyDate, "");
    }

    public String getPicture() {
        return picture;
    }

    public String getPatientName() {
        return patientName;
    }

    public String getPatientBirthDate() {
        return patientBirthDate;
    }

    public String getInstitution() {
        return institution;
    }

    public String getStation() {
        return station;
    }

    public String getStudyDescription() {
        return studyDescription;
    }

    public String getSeriesDescription() {
        return seriesDescription;
    }

    public String getManufacturerModelName() {
        return manufacturerModelName;
    }

    public String getManufacturer() {
        return manufacturer;
    }

    public String getStudyDate() {
        return studyDate;
    }
}
